package main

import (
	"fmt"
	colorstyle "gitee.com/chenwitt/photographcover/color"
	"image"
	_ "image/png"
	"log"
	"os"
)

func main() {

	//Step 1: Load the image
	img, err := loadImage("C:\\Users\\1\\Desktop\\tem\\img\\bg2.png")
	if err != nil {
		log.Fatal("Failed to load image", err)
	}

	colorCode := colorstyle.ExtractColor(img)
	fmt.Println(colorCode)
	//color.InitColor()
}

func loadImage(fileInput string) (image.Image, error) {
	f, err := os.Open(fileInput)
	if err != nil {
		return nil, err
	}
	defer f.Close()
	img, _, err := image.Decode(f)
	return img, err
}
